/*
 * RPedidoForm.java
 *
 * Created on 7 de junio de 2008, 20:00
 */
package View;
import javax.swing.UIManager;
import com.birosoft.liquid.*;

import Controller.RPedidoController;
import Model.Cliente; 
import Model.Congreso;
import Model.Pedido;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Calendar; 
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
import java.lang.String;
/**
 *
 * @author  Gigin
 */
public class RPedidoForm extends javax.swing.JFrame {

    // Controller del Form
    private RPedidoController mRPedidoController;
    
    //Para manejar pantallas
    private PpalForm ppal;
    private String modo;
    CheckBoxListener myListener = new CheckBoxListener();
    
    //ArrayList para los checkBox de DVDs
    private ArrayList<javax.swing.JCheckBox> checks = new ArrayList();
 
    //Para el pedido que se generara
    private Congreso mCongreso;
    private Cliente mCliente;
    private ArrayList<Integer> mDvds;
    private ArrayList<String> mClientes;
    private Pedido mPedido;
    
    private float subtotal = 0;
    private float total = 0;
    private float deuda = 0;
    private int cuentachecks = 0;
	
    private javax.swing.DefaultComboBoxModel modeloCombo = new javax.swing.DefaultComboBoxModel();

    //Control de checkBoxes
    private ArrayList<Boolean> virtualChecks1 = new ArrayList<Boolean>(); 
    private ArrayList<Boolean> virtualChecks2 = new ArrayList<Boolean>(); 
    private ArrayList<Boolean> virtualChecks3 = new ArrayList<Boolean>(); 
    private ArrayList<Boolean> virtualChecks4 = new ArrayList<Boolean>(); 
    int listaCheckActual=1;

    /** Crea la pantalla RPedidoForm */
    public RPedidoForm(String modo, Congreso cong) {
        //Se crea el controller de la pantalla
        mRPedidoController = new RPedidoController();
        this.setModo(modo);
        this.setCongreso(cong);
        
        // Se carga el Look and Feel
        try {
            UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");   
        } catch (Exception e) { }
        LiquidLookAndFeel.setStipples(false);
   
        //Se crean los componentes del Form 
        initComponents();
	jComboNombre.setModel(modeloCombo);
        this.setSize(this.getMaximumSize());
        
        //Se deshabilitan los paneles de Clientes y Pedido
         panelClienteEstado(false);
         panelPedidoEstado(false);
         jComboDescuento.setEnabled(false);
         jTextSenia.setEnabled(false);
         jLabelAviso.setVisible(false);
         Modificar_cliente.setEnabled(false);
         
         // Crea el arrayList de Clientes
         mRPedidoController.cargarClientes();
    
         // Crea los 50 checkBox para cada DVD del congreso pero invisibles 
         // hasta que se seleccione un congreso y se sepa la cant. de DVDs
         checksDvd();
         inicializarChecks();
         
        
         if (this.getModo().compareTo("Oficina") == 0){
             // Crea el arrayList de Congresos
             mRPedidoController.cargarCongresos();
             // Carga el combo de Congresos
             cargarComboCongresos();
         }else 
             if(this.getModo().compareTo("Congreso") == 0){
                 mRPedidoController.setCongreso(this.getCongreso());
                 jComboCongresos.addItem(mRPedidoController.getCongreso());
                 jComboCongresos.setEnabled(false);
            }
         
         // Carga el Combo de las especialidades.
         mRPedidoController.cargarEspecialidades();
         
         // Carga el Combo de las localidades.
         mRPedidoController.cargarLocalidades();
         
         // Carga el Combo de las localidades.
         mRPedidoController.cargarProvincias();
         
         // Carga el Combo de las localidades.
         mRPedidoController.cargarPaises();
         mRPedidoController.cargadatosCombo(jComboEspecialidad, mRPedidoController.getEspecialidades());
         mRPedidoController.cargadatosCombo(jComboLocalidad, mRPedidoController.getLocalidades());
         mRPedidoController.cargadatosCombo(jComboProvincia, mRPedidoController.getProvincias());
         mRPedidoController.cargadatosCombo(jComboPais, mRPedidoController.getPaises());
         
         // Crea el arrayList de Apellidos de los Clientes
         mRPedidoController.cargarApellidos();
         
         // Crea el combo de Apellidos de clientes
         mClientes = mRPedidoController.getApellidos();
         //Carga el combo de los Apellidos.
         mRPedidoController.cargaCombos(jComboApellido,mRPedidoController.getApellidos());
         //Carga el combo de las especialidades.
         mRPedidoController.cargaCombos(jComboEspecialidad, mRPedidoController.getEspecialidades());
         //Carga el combo de las Localidades.
         mRPedidoController.cargaCombos(jComboLocalidad, mRPedidoController.getLocalidades());
         //Carga el combo de las Provincias.
         mRPedidoController.cargaCombos(jComboProvincia, mRPedidoController.getProvincias());
         //Carga el combo de los Paises.
         mRPedidoController.cargaCombos(jComboPais, mRPedidoController.getPaises());  
         
         
         
    }

    private void botonesChecks(){
        int auxCan=mRPedidoController.getCongreso().getCantDvd();
        switch(listaCheckActual){
            case 1: this.jButtonMenosCheck.setVisible(false);
                    if (auxCan>50) this.jButtonMasCheck.setVisible(true);
                        else this.jButtonMasCheck.setVisible(false);
                    break;
            case 2: this.jButtonMenosCheck.setVisible(true);
                    if (auxCan>100) this.jButtonMasCheck.setVisible(true);
                        else this.jButtonMasCheck.setVisible(false);
                    break;
            case 3: this.jButtonMenosCheck.setVisible(true);
                    if (auxCan>150) this.jButtonMasCheck.setVisible(true);
                        else this.jButtonMasCheck.setVisible(false);
                    break;
            case 4: this.jButtonMenosCheck.setVisible(true);
                    this.jButtonMasCheck.setVisible(false);
                    break;
            
        }
    }
    private void inicializarChecks (){
        for (int i=0;i<50;i++){
            virtualChecks1.add(false);
            virtualChecks2.add(false);
            virtualChecks3.add(false);
            virtualChecks4.add(false);
        }
            
    };
    
    private void reinicializarChecks(){
        for (int i=0;i<50;i++){
            virtualChecks1.set(i,false);
            virtualChecks2.set(i,false);
            virtualChecks3.set(i,false);
            virtualChecks4.set(i,false);
        }
    }
    
    /*Copia el estado actual de los checks en un array*/
    private ArrayList<Boolean> copiarChecks(ArrayList<javax.swing.JCheckBox> chec){
        ArrayList<Boolean> aux = new ArrayList<Boolean>();
        for (int i=0;i<chec.size();i++){
            boolean auxB = chec.get(i).isSelected();
            aux.add(auxB);
        }
        return aux;
    } 
    /*Setea el estado actual de los check para que coincidan con los del array*/
    private void restaurarChecks(ArrayList<javax.swing.JCheckBox> chec, ArrayList<Boolean> otro){
        for (int i=0;i<chec.size();i++)
            chec.get(i).setSelected(otro.get(i));
    }
    
    
    /** Habilita o deshabilita los componentes del panel de Clientes */
    public void panelClienteEstado(boolean estado){
            jComboApellido.setEnabled(estado);
            jComboNombre.setEnabled(estado);
            jComboTipoDoc.setEnabled(estado);
            jTextDoc.setEnabled(estado);
            jComboDiaNac.setEnabled(estado);
            jComboMesNac.setEnabled(estado);
            jComboAnioNac.setEnabled(estado);
            jTextTelFijo.setEnabled(estado);
            jTextTelMovil.setEnabled(estado);
            jTextMatricula.setEnabled(estado);
            jComboEspecialidad.setEnabled(estado);
            jTextMail.setEnabled(estado);
            jTextDireccion.setEnabled(estado);
            jComboLocalidad.setEnabled(estado);
            jComboProvincia.setEnabled(estado);
            jTextCp.setEnabled(estado);
            jComboPais.setEnabled(estado);
            jTextHobbie.setEnabled(estado);
            jButtonHistorial.setEnabled(estado);
            jButtonAcepta.setEnabled(estado);
            jButtonLimpiar.setEnabled(estado);
    }
   
    
    /** Habilita o deshabilita los componentes del panel de Pedido */
    public void panelPedidoEstado(boolean estado){
        
        jCheckTodos.setEnabled(estado);
        jComboMoneda.setEnabled(estado);
     //   jComboDescuento.setEnabled(estado);
     //   jTextSenia.setEnabled(estado);
        jCheckEntregado.setEnabled(estado);
        jCheckEnviar.setEnabled(estado);
        jComboDia.setEnabled(estado);
        jComboMes.setEnabled(estado);
        jComboAnio.setEnabled(estado);
        jButtonAceptar.setEnabled(estado);
        jButtonMasCheck.setEnabled(estado);
        jButtonMenosCheck.setEnabled(estado);
        
    }
  
    
    //Busca en el combo de apellidos el Apellido que se acaba de ingresar.
    public void buscaComboApellido(){
        int buscaApellido=0;
        if(jComboApellido.getSelectedItem() != null)
            for (int i=0;i<mRPedidoController.getApellidos().size();i++){
            if (((String)jComboApellido.getSelectedItem()).equalsIgnoreCase((String)mRPedidoController.getApellidos().get(i))==true){
             buscaApellido=1;
            }
        }
       //jComboNombre.removeAllItems();
        modeloCombo.removeAllElements();
        if (buscaApellido==1){
            cargaComboNombres();
        }
    }
    //Carga el combo con nombres si el apellido fue reconocido.
    public void cargaComboNombres(){
        for(int i=0;i < mRPedidoController.getClientes().size();i++){
           if(mRPedidoController.getClientes().get(i).getApellidoCli().equalsIgnoreCase((String)jComboApellido.getSelectedItem())==true){
             jComboNombre.addItem(mRPedidoController.getClientes().get(i));
        }
    }}
    
    
   /** Carga los checkBox en un ArrayList y los hace invisibles*/ 
    private void checksDvd(){
            
        checks.add(jCheck1);  
        checks.add(jCheck2); 
        checks.add(jCheck3); 
        checks.add(jCheck4);  
        checks.add(jCheck5); 
        checks.add(jCheck6);
        checks.add(jCheck7);  
        checks.add(jCheck8); 
        checks.add(jCheck9); 
        checks.add(jCheck10);  
        checks.add(jCheck11); 
        checks.add(jCheck12); 
        checks.add(jCheck13);  
        checks.add(jCheck14); 
        checks.add(jCheck15);
        checks.add(jCheck16);  
        checks.add(jCheck17); 
        checks.add(jCheck18); 
        checks.add(jCheck19); 
        checks.add(jCheck20); 
        checks.add(jCheck21);  
        checks.add(jCheck22); 
        checks.add(jCheck23);
        checks.add(jCheck24);  
        checks.add(jCheck25); 
        checks.add(jCheck26);
        checks.add(jCheck27); 
        checks.add(jCheck28);
        checks.add(jCheck29);  
        checks.add(jCheck30); 
        checks.add(jCheck31);
        checks.add(jCheck32); 
        checks.add(jCheck33);
        checks.add(jCheck34);
        checks.add(jCheck35); 
        checks.add(jCheck36);
        checks.add(jCheck37); 
        checks.add(jCheck38);
        checks.add(jCheck39);  
        checks.add(jCheck40); 
        checks.add(jCheck41);
        checks.add(jCheck42); 
        checks.add(jCheck43);
        checks.add(jCheck44);
        checks.add(jCheck45); 
        checks.add(jCheck46);
        checks.add(jCheck47); 
        checks.add(jCheck48);
        checks.add(jCheck49);  
        checks.add(jCheck50); 
        
        
        for (int i=0 ; i<50 ; i++){
            checks.get(i).setVisible(false);
            checks.get(i).addItemListener(myListener);
        }
            
    }  
  
 
  /** Carga el combo de Congresos */
    public void cargarComboCongresos(){
       
        for (int i=0 ; i < mRPedidoController.getCongresos().size()-1 ; i++)
             jComboCongresos.addItem(mRPedidoController.getCongresos().get(i));  
       
    }
            
              
    /** Inicializa el formulario de Pedidos  */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jCheckBox6 = new javax.swing.JCheckBox();
        buttonGroup1 = new javax.swing.ButtonGroup();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jPanelPedido = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabelSubtotal = new javax.swing.JLabel();
        jComboDescuento = new javax.swing.JComboBox();
        jLabel15 = new javax.swing.JLabel();
        jLabelTotal = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jTextSenia = new javax.swing.JTextField();
        jCheckEntregado = new javax.swing.JCheckBox();
        jCheckEnviar = new javax.swing.JCheckBox();
        jLabel16 = new javax.swing.JLabel();
        jComboDia = new javax.swing.JComboBox();
        jComboMes = new javax.swing.JComboBox();
        jComboAnio = new javax.swing.JComboBox();
        jLabel17 = new javax.swing.JLabel();
        jLabelDeuda = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jPanel2 = new javax.swing.JPanel();
        jComboMoneda = new javax.swing.JComboBox();
        jPanel4 = new javax.swing.JPanel();
        jLabelAviso = new javax.swing.JLabel();
        jButtonCancelar = new javax.swing.JButton();
        Modificar_cliente = new javax.swing.JButton();
        jButtonAceptar = new javax.swing.JButton();
        jCheckTodos = new javax.swing.JCheckBox();
        jButtonMenosCheck = new javax.swing.JButton();
        jButtonMasCheck = new javax.swing.JButton();
        jCheck1 = new javax.swing.JCheckBox();
        jCheck2 = new javax.swing.JCheckBox();
        jCheck3 = new javax.swing.JCheckBox();
        jCheck4 = new javax.swing.JCheckBox();
        jCheck5 = new javax.swing.JCheckBox();
        jCheck6 = new javax.swing.JCheckBox();
        jCheck7 = new javax.swing.JCheckBox();
        jCheck8 = new javax.swing.JCheckBox();
        jCheck9 = new javax.swing.JCheckBox();
        jCheck10 = new javax.swing.JCheckBox();
        jCheck11 = new javax.swing.JCheckBox();
        jCheck12 = new javax.swing.JCheckBox();
        jCheck13 = new javax.swing.JCheckBox();
        jCheck14 = new javax.swing.JCheckBox();
        jCheck15 = new javax.swing.JCheckBox();
        jCheck16 = new javax.swing.JCheckBox();
        jCheck17 = new javax.swing.JCheckBox();
        jCheck18 = new javax.swing.JCheckBox();
        jCheck19 = new javax.swing.JCheckBox();
        jCheck20 = new javax.swing.JCheckBox();
        jCheck21 = new javax.swing.JCheckBox();
        jCheck22 = new javax.swing.JCheckBox();
        jCheck23 = new javax.swing.JCheckBox();
        jCheck24 = new javax.swing.JCheckBox();
        jCheck25 = new javax.swing.JCheckBox();
        jCheck26 = new javax.swing.JCheckBox();
        jCheck27 = new javax.swing.JCheckBox();
        jCheck28 = new javax.swing.JCheckBox();
        jCheck29 = new javax.swing.JCheckBox();
        jCheck30 = new javax.swing.JCheckBox();
        jCheck31 = new javax.swing.JCheckBox();
        jCheck32 = new javax.swing.JCheckBox();
        jCheck33 = new javax.swing.JCheckBox();
        jCheck34 = new javax.swing.JCheckBox();
        jCheck35 = new javax.swing.JCheckBox();
        jCheck36 = new javax.swing.JCheckBox();
        jCheck37 = new javax.swing.JCheckBox();
        jCheck38 = new javax.swing.JCheckBox();
        jCheck39 = new javax.swing.JCheckBox();
        jCheck40 = new javax.swing.JCheckBox();
        jCheck41 = new javax.swing.JCheckBox();
        jCheck42 = new javax.swing.JCheckBox();
        jCheck43 = new javax.swing.JCheckBox();
        jCheck44 = new javax.swing.JCheckBox();
        jCheck45 = new javax.swing.JCheckBox();
        jCheck46 = new javax.swing.JCheckBox();
        jCheck47 = new javax.swing.JCheckBox();
        jCheck48 = new javax.swing.JCheckBox();
        jCheck49 = new javax.swing.JCheckBox();
        jCheck50 = new javax.swing.JCheckBox();
        jPanelCliente = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jComboTipoDoc = new javax.swing.JComboBox();
        jTextDoc = new javax.swing.JTextField();
        jTextMatricula = new javax.swing.JTextField();
        jTextMail = new javax.swing.JTextField();
        jTextDireccion = new javax.swing.JTextField();
        jComboEspecialidad = new javax.swing.JComboBox();
        jComboPais = new javax.swing.JComboBox();
        jButtonHistorial = new javax.swing.JButton();
        jTextCp = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jTextHobbie = new javax.swing.JTextField();
        jButtonAcepta = new javax.swing.JButton();
        jComboApellido = new javax.swing.JComboBox();
        jComboNombre = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        jComboDiaNac = new javax.swing.JComboBox();
        jComboMesNac = new javax.swing.JComboBox();
        jComboAnioNac = new javax.swing.JComboBox();
        jLabel21 = new javax.swing.JLabel();
        jTextTelFijo = new javax.swing.JTextField();
        jTextTelMovil = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jComboLocalidad = new javax.swing.JComboBox();
        jComboProvincia = new javax.swing.JComboBox();
        jButtonLimpiar = new javax.swing.JButton();
        jPanelTitulo = new javax.swing.JPanel();
        jLabelTitulo = new javax.swing.JLabel();
        jComboCongresos = new javax.swing.JComboBox();
        jLabel23 = new javax.swing.JLabel();
        jLabelFechaInicio = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabelFechaFin = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabelCiudad = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();

        jCheckBox6.setText("jCheckBox6");

        jButton1.setText("jButton1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SADC");

        jPanelPedido.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "PEDIDO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12), new java.awt.Color(94, 148, 189))); // NOI18N
        jPanelPedido.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel11.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel11.setText("Subtotal: $");

        jLabel12.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel12.setText("Descuento");

        jLabel13.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel13.setText("Total: $");

        jLabelSubtotal.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabelSubtotal.setText("0");

        jComboDescuento.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboDescuento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "5", "10", "15", "20", "100" }));
        jComboDescuento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboDescuentoActionPerformed(evt);
            }
        });

        jLabel15.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel15.setText("%");

        jLabelTotal.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabelTotal.setText("0");

        jLabel14.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel14.setText("Seña");

        jTextSenia.setFont(new java.awt.Font("Verdana", 0, 10));
        jTextSenia.setText("0");
        jTextSenia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextSeniaActionPerformed(evt);
            }
        });
        jTextSenia.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextSeniaKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextSeniaKeyTyped(evt);
            }
        });

        jCheckEntregado.setFont(new java.awt.Font("Verdana", 1, 10));
        jCheckEntregado.setText("Entregado");
        jCheckEntregado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckEntregadoActionPerformed(evt);
            }
        });

        jCheckEnviar.setFont(new java.awt.Font("Verdana", 1, 10));
        jCheckEnviar.setText("Enviar");
        jCheckEnviar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckEnviarActionPerformed(evt);
            }
        });

        jLabel16.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel16.setText("Fecha envío");

        jComboDia.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        jComboMes.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));

        jComboAnio.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboAnio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        jLabel17.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel17.setText("Adeuda: $");

        jLabelDeuda.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabelDeuda.setText("0");

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                        .addGap(14, 14, 14)
                        .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
                    .addComponent(jLabel13)
                    .addComponent(jLabel12)
                    .addComponent(jLabel11)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelTotal)
                    .addComponent(jLabelDeuda)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jTextSenia, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelSubtotal, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboDescuento, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15)))
                .addGap(9, 9, 9)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckEnviar)
                    .addComponent(jCheckEntregado)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboAnio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(20, 20, 20))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(12, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelSubtotal)
                            .addComponent(jLabel11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboDescuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15)
                            .addComponent(jLabel12))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelTotal)
                            .addComponent(jLabel13))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextSenia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(jLabelDeuda)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jCheckEntregado)
                        .addGap(29, 29, 29)
                        .addComponent(jCheckEnviar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(jComboDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jComboMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jComboAnio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(98, 98, 98))
        );

        jPanelPedido.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 290, -1, 180));

        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        jPanelPedido.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        jComboMoneda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboMonedaActionPerformed(evt);
            }
        });
        jPanelPedido.add(jComboMoneda, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 240, 110, -1));

        jLabelAviso.setFont(new java.awt.Font("Verdana", 2, 10));
        jLabelAviso.setForeground(new java.awt.Color(255, 0, 0));
        jLabelAviso.setText("Debe aceptar el cliente para poder aceptar el pedido.");

        jButtonCancelar.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonCancelar.setForeground(new java.awt.Color(94, 148, 189));
        jButtonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_normal.gif"))); // NOI18N
        jButtonCancelar.setToolTipText("Volver a la pantalla principal");
        jButtonCancelar.setBorderPainted(false);
        jButtonCancelar.setContentAreaFilled(false);
        jButtonCancelar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_deshabilitado.gif"))); // NOI18N
        jButtonCancelar.setFocusPainted(false);
        jButtonCancelar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_presionado.gif"))); // NOI18N
        jButtonCancelar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_mouse.gif"))); // NOI18N
        jButtonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCancelarActionPerformed(evt);
            }
        });

        Modificar_cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_normal.gif"))); // NOI18N
        Modificar_cliente.setBorderPainted(false);
        Modificar_cliente.setContentAreaFilled(false);
        Modificar_cliente.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_deshabilitado.gif"))); // NOI18N
        Modificar_cliente.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_presionado.gif"))); // NOI18N
        Modificar_cliente.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_mouse.gif"))); // NOI18N
        Modificar_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Modificar_clienteActionPerformed(evt);
            }
        });

        jButtonAceptar.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonAceptar.setForeground(new java.awt.Color(94, 148, 189));
        jButtonAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_normal.gif"))); // NOI18N
        jButtonAceptar.setToolTipText("Almacenar el pedido");
        jButtonAceptar.setBorderPainted(false);
        jButtonAceptar.setContentAreaFilled(false);
        jButtonAceptar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_deshabilitado.gif"))); // NOI18N
        jButtonAceptar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_presionado.gif"))); // NOI18N
        jButtonAceptar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_mouse.gif"))); // NOI18N
        jButtonAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(103, 103, 103)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jButtonAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButtonCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Modificar_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabelAviso))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Modificar_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButtonAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelAviso)))
                .addGap(23, 23, 23))
        );

        jPanelPedido.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 460, 510, 80));

        jCheckTodos.setFont(new java.awt.Font("Verdana", 1, 10)); // NOI18N
        jCheckTodos.setText("Todos");
        jCheckTodos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckTodosActionPerformed(evt);
            }
        });
        jPanelPedido.add(jCheckTodos, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 180, -1, -1));

        jButtonMenosCheck.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_normal.gif"))); // NOI18N
        jButtonMenosCheck.setToolTipText("Ver anterior");
        jButtonMenosCheck.setBorderPainted(false);
        jButtonMenosCheck.setContentAreaFilled(false);
        jButtonMenosCheck.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_deshabilitado.gif"))); // NOI18N
        jButtonMenosCheck.setFocusPainted(false);
        jButtonMenosCheck.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_presionado.gif"))); // NOI18N
        jButtonMenosCheck.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_mouse.gif"))); // NOI18N
        jButtonMenosCheck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMenosCheckActionPerformed(evt);
            }
        });
        jPanelPedido.add(jButtonMenosCheck, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 180, 60, 30));

        jButtonMasCheck.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_normal.gif"))); // NOI18N
        jButtonMasCheck.setToolTipText("Ver siguiente");
        jButtonMasCheck.setBorderPainted(false);
        jButtonMasCheck.setContentAreaFilled(false);
        jButtonMasCheck.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_deshabilitado.gif"))); // NOI18N
        jButtonMasCheck.setFocusPainted(false);
        jButtonMasCheck.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_presionado.gif"))); // NOI18N
        jButtonMasCheck.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_mouse.gif"))); // NOI18N
        jButtonMasCheck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMasCheckActionPerformed(evt);
            }
        });
        jPanelPedido.add(jButtonMasCheck, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 180, 60, 30));

        jCheck1.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck1.setText("01");
        jPanelPedido.add(jCheck1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        jCheck2.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck2.setText("02");
        jPanelPedido.add(jCheck2, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 20, -1, -1));

        jCheck3.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck3.setText("03");
        jPanelPedido.add(jCheck3, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 20, -1, -1));

        jCheck4.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck4.setText("04");
        jPanelPedido.add(jCheck4, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 20, -1, -1));

        jCheck5.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck5.setText("05");
        jPanelPedido.add(jCheck5, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 20, -1, -1));

        jCheck6.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck6.setText("06");
        jPanelPedido.add(jCheck6, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 20, -1, -1));

        jCheck7.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck7.setText("07");
        jPanelPedido.add(jCheck7, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 20, -1, -1));

        jCheck8.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck8.setText("08");
        jPanelPedido.add(jCheck8, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 20, -1, -1));

        jCheck9.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck9.setText("09");
        jPanelPedido.add(jCheck9, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 20, -1, -1));

        jCheck10.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck10.setText("10");
        jPanelPedido.add(jCheck10, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 20, -1, -1));

        jCheck11.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck11.setText("11");
        jPanelPedido.add(jCheck11, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));

        jCheck12.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck12.setText("12");
        jPanelPedido.add(jCheck12, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 50, -1, -1));

        jCheck13.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck13.setText("13");
        jPanelPedido.add(jCheck13, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 50, -1, -1));

        jCheck14.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck14.setText("14");
        jPanelPedido.add(jCheck14, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 50, -1, -1));

        jCheck15.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck15.setText("15");
        jPanelPedido.add(jCheck15, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 50, -1, -1));

        jCheck16.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck16.setText("16");
        jPanelPedido.add(jCheck16, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 50, -1, -1));

        jCheck17.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck17.setText("17");
        jPanelPedido.add(jCheck17, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 50, -1, -1));

        jCheck18.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck18.setText("18");
        jPanelPedido.add(jCheck18, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 50, -1, -1));

        jCheck19.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck19.setText("19");
        jPanelPedido.add(jCheck19, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 50, -1, -1));

        jCheck20.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck20.setText("20");
        jPanelPedido.add(jCheck20, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 50, -1, -1));

        jCheck21.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck21.setText("21");
        jPanelPedido.add(jCheck21, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, -1, -1));

        jCheck22.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck22.setText("22");
        jPanelPedido.add(jCheck22, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 80, -1, -1));

        jCheck23.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck23.setText("23");
        jPanelPedido.add(jCheck23, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, -1, -1));

        jCheck24.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck24.setText("24");
        jPanelPedido.add(jCheck24, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 80, -1, -1));

        jCheck25.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck25.setText("25");
        jPanelPedido.add(jCheck25, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 80, -1, -1));

        jCheck26.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck26.setText("26");
        jPanelPedido.add(jCheck26, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 80, -1, -1));

        jCheck27.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck27.setText("27");
        jPanelPedido.add(jCheck27, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 80, -1, -1));

        jCheck28.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck28.setText("28");
        jPanelPedido.add(jCheck28, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 80, -1, -1));

        jCheck29.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck29.setText("29");
        jPanelPedido.add(jCheck29, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 80, -1, -1));

        jCheck30.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck30.setText("30");
        jPanelPedido.add(jCheck30, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 80, -1, -1));

        jCheck31.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck31.setText("31");
        jPanelPedido.add(jCheck31, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1));

        jCheck32.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck32.setText("32");
        jPanelPedido.add(jCheck32, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 110, -1, -1));

        jCheck33.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck33.setText("33");
        jPanelPedido.add(jCheck33, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 110, -1, -1));

        jCheck34.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck34.setText("34");
        jPanelPedido.add(jCheck34, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 110, -1, -1));

        jCheck35.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck35.setText("35");
        jPanelPedido.add(jCheck35, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 110, -1, -1));

        jCheck36.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck36.setText("36");
        jPanelPedido.add(jCheck36, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 110, -1, -1));

        jCheck37.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck37.setText("37");
        jCheck37.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheck37ActionPerformed(evt);
            }
        });
        jPanelPedido.add(jCheck37, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 110, -1, -1));

        jCheck38.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck38.setText("38");
        jPanelPedido.add(jCheck38, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 110, -1, -1));

        jCheck39.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck39.setText("39");
        jPanelPedido.add(jCheck39, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 110, -1, -1));

        jCheck40.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck40.setText("40");
        jPanelPedido.add(jCheck40, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 110, -1, -1));

        jCheck41.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck41.setText("41");
        jPanelPedido.add(jCheck41, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, -1, -1));

        jCheck42.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck42.setText("42");
        jPanelPedido.add(jCheck42, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 140, -1, -1));

        jCheck43.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck43.setText("43");
        jPanelPedido.add(jCheck43, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 140, -1, -1));

        jCheck44.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck44.setText("44");
        jPanelPedido.add(jCheck44, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 140, -1, -1));

        jCheck45.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck45.setText("45");
        jPanelPedido.add(jCheck45, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 140, -1, -1));

        jCheck46.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck46.setText("46");
        jPanelPedido.add(jCheck46, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 140, -1, -1));

        jCheck47.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck47.setText("47");
        jPanelPedido.add(jCheck47, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 140, -1, -1));

        jCheck48.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck48.setText("48");
        jPanelPedido.add(jCheck48, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 140, -1, -1));

        jCheck49.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck49.setText("49");
        jPanelPedido.add(jCheck49, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 140, -1, -1));

        jCheck50.setFont(new java.awt.Font("Verdana", 0, 10));
        jCheck50.setText("50");
        jPanelPedido.add(jCheck50, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 140, -1, -1));

        jPanelCliente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "CLIENTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12), new java.awt.Color(94, 148, 189))); // NOI18N
        jPanelCliente.setForeground(new java.awt.Color(255, 204, 204));

        jLabel1.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel1.setText("Nombre");

        jLabel2.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel2.setText("Apellido");

        jLabel3.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel3.setText("Documento");

        jLabel4.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel4.setText("Matrícula");

        jLabel5.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel5.setText("Especialidad");

        jLabel6.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel6.setText("Dirección");

        jLabel7.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel7.setText("Localidad");

        jLabel8.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel8.setText("CP");

        jLabel9.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel9.setText("Provincia");

        jLabel10.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel10.setText("País");

        jComboTipoDoc.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboTipoDoc.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "DNI", "PASS", "CED", "OTRO" }));

        jTextDoc.setFont(new java.awt.Font("Verdana", 0, 10));

        jTextMatricula.setFont(new java.awt.Font("Verdana", 0, 10));

        jTextMail.setFont(new java.awt.Font("Verdana", 0, 10));

        jTextDireccion.setFont(new java.awt.Font("Verdana", 0, 10));

        jComboEspecialidad.setEditable(true);
        jComboEspecialidad.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboEspecialidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

        jComboPais.setEditable(true);
        jComboPais.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboPais.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

        jButtonHistorial.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonHistorial.setForeground(new java.awt.Color(94, 148, 189));
        jButtonHistorial.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Historial_normal.gif"))); // NOI18N
        jButtonHistorial.setToolTipText("Ver historial de pedidos del cliente");
        jButtonHistorial.setBorderPainted(false);
        jButtonHistorial.setContentAreaFilled(false);
        jButtonHistorial.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Historial_deshabilitado.gif"))); // NOI18N
        jButtonHistorial.setFocusPainted(false);
        jButtonHistorial.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Historial_presionado.gif"))); // NOI18N
        jButtonHistorial.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Historial_mouse.gif"))); // NOI18N
        jButtonHistorial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonHistorialActionPerformed(evt);
            }
        });

        jTextCp.setFont(new java.awt.Font("Verdana", 0, 10));
        jTextCp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextCpActionPerformed(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel19.setText("Mail");

        jLabel20.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel20.setText("Hobbie");

        jTextHobbie.setFont(new java.awt.Font("Verdana", 0, 10));
        jTextHobbie.setText(" ");

        jButtonAcepta.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonAcepta.setForeground(new java.awt.Color(94, 148, 189));
        jButtonAcepta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_normal.gif"))); // NOI18N
        jButtonAcepta.setToolTipText("Seleccionar cliente");
        jButtonAcepta.setBorderPainted(false);
        jButtonAcepta.setContentAreaFilled(false);
        jButtonAcepta.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_deshabilitado.gif"))); // NOI18N
        jButtonAcepta.setFocusPainted(false);
        jButtonAcepta.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_presionado.gif"))); // NOI18N
        jButtonAcepta.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_mouse.gif"))); // NOI18N
        jButtonAcepta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAceptaActionPerformed(evt);
            }
        });

        jComboApellido.setEditable(true);
        jComboApellido.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboApellido.setNextFocusableComponent(jComboNombre);
        jComboApellido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboApellidoActionPerformed(evt);
            }
        });

        jComboNombre.setEditable(true);
        jComboNombre.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboNombre.setNextFocusableComponent(jComboDiaNac);
        jComboNombre.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboNombreItemStateChanged(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel18.setText("Fecha de nacimiento");

        jComboDiaNac.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboDiaNac.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        jComboDiaNac.setNextFocusableComponent(jComboMesNac);

        jComboMesNac.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboMesNac.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));

        jComboAnioNac.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboAnioNac.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "1930", "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007" }));

        jLabel21.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel21.setText("Teléfono fijo");

        jTextTelFijo.setFont(new java.awt.Font("Verdana", 0, 10));

        jTextTelMovil.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabel22.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel22.setText("Teléfono móvil");

        jComboLocalidad.setEditable(true);
        jComboLocalidad.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboLocalidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

        jComboProvincia.setEditable(true);
        jComboProvincia.setFont(new java.awt.Font("Verdana", 0, 10));
        jComboProvincia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

        jButtonLimpiar.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonLimpiar.setForeground(new java.awt.Color(94, 148, 189));
        jButtonLimpiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Limpiar_normal.gif"))); // NOI18N
        jButtonLimpiar.setToolTipText("Poner en blanco los renglones");
        jButtonLimpiar.setBorderPainted(false);
        jButtonLimpiar.setContentAreaFilled(false);
        jButtonLimpiar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Lipiar_deshabilitado.gif"))); // NOI18N
        jButtonLimpiar.setFocusPainted(false);
        jButtonLimpiar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Limpiar_presionado.gif"))); // NOI18N
        jButtonLimpiar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Limpiar_mouse.gif"))); // NOI18N
        jButtonLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLimpiarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelClienteLayout = new javax.swing.GroupLayout(jPanelCliente);
        jPanelCliente.setLayout(jPanelClienteLayout);
        jPanelClienteLayout.setHorizontalGroup(
            jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelClienteLayout.createSequentialGroup()
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelClienteLayout.createSequentialGroup()
                        .addGap(77, 77, 77)
                        .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel20)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jComboPais, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextHobbie, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanelClienteLayout.createSequentialGroup()
                                    .addComponent(jButtonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonHistorial, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelClienteLayout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButtonAcepta, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(84, 84, 84)))))
                    .addGroup(jPanelClienteLayout.createSequentialGroup()
                        .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel3)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1)
                            .addComponent(jLabel18)
                            .addComponent(jLabel21)
                            .addComponent(jLabel22)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5)
                            .addComponent(jLabel19)
                            .addComponent(jLabel7)
                            .addComponent(jLabel9)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jComboProvincia, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboLocalidad, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextTelMovil)
                            .addComponent(jTextCp)
                            .addComponent(jTextDireccion)
                            .addComponent(jTextMail)
                            .addComponent(jComboEspecialidad, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextMatricula)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelClienteLayout.createSequentialGroup()
                                .addComponent(jComboTipoDoc, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextDoc))
                            .addComponent(jTextTelFijo)
                            .addComponent(jComboNombre, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboApellido, javax.swing.GroupLayout.Alignment.TRAILING, 0, 274, Short.MAX_VALUE)
                            .addGroup(jPanelClienteLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jComboDiaNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboMesNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboAnioNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(36, 36, 36))
        );
        jPanelClienteLayout.setVerticalGroup(
            jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jComboDiaNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboMesNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboAnioNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jTextTelFijo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel22)
                    .addComponent(jTextTelMovil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboTipoDoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jTextDoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextMatricula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jComboEspecialidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(jTextMail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelClienteLayout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jComboLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jComboProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextCp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jComboPais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jTextHobbie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(37, 37, 37)
                .addComponent(jButtonAcepta, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jButtonHistorial, 0, 0, Short.MAX_VALUE)
                    .addComponent(jButtonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(119, Short.MAX_VALUE))
        );

        jLabelTitulo.setFont(new java.awt.Font("Monotype Corsiva", 1, 24));
        jLabelTitulo.setForeground(new java.awt.Color(94, 148, 189));
        jLabelTitulo.setText("Seleccionar un congreso para comenzar");

        jComboCongresos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboCongresosActionPerformed(evt);
            }
        });

        jLabel23.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel23.setForeground(new java.awt.Color(94, 148, 189));
        jLabel23.setText("Fecha Inicio:");

        jLabelFechaInicio.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabel24.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel24.setForeground(new java.awt.Color(94, 148, 189));
        jLabel24.setText("Fecha fin:");

        jLabelFechaFin.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabel25.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel25.setForeground(new java.awt.Color(94, 148, 189));
        jLabel25.setText("Ciudad:");

        jLabelCiudad.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/logo_GTV4.gif"))); // NOI18N

        javax.swing.GroupLayout jPanelTituloLayout = new javax.swing.GroupLayout(jPanelTitulo);
        jPanelTitulo.setLayout(jPanelTituloLayout);
        jPanelTituloLayout.setHorizontalGroup(
            jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTituloLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel26)
                .addGap(60, 60, 60)
                .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jComboCongresos, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 527, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanelTituloLayout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelFechaInicio)
                        .addGap(42, 42, 42)
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelFechaFin)
                        .addGap(38, 38, 38)
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelCiudad)))
                .addContainerGap(488, Short.MAX_VALUE))
        );
        jPanelTituloLayout.setVerticalGroup(
            jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTituloLayout.createSequentialGroup()
                .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel26)
                    .addGroup(jPanelTituloLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jComboCongresos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                        .addComponent(jLabelTitulo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel23)
                            .addComponent(jLabelFechaInicio)
                            .addComponent(jLabel24)
                            .addComponent(jLabelFechaFin)
                            .addComponent(jLabel25)
                            .addComponent(jLabelCiudad))))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanelCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanelPedido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(384, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanelPedido, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanelCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1008, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

 
    /** Validar datos de Cliente. HACER!*/
private boolean validarCampos(){
   
      try{
    if (((String)this.jComboApellido.getSelectedItem()).compareTo("")==0 ){
        JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Apellido", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
    }
   } catch (Exception e) { 
        JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Apellido", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
        }
   

   try{
   if (((String)this.jComboNombre.getSelectedItem()).compareTo("")==0 ){
        JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Nombre", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
    } 
   } catch (Exception e) { 
       try{
       Cliente c = ((Cliente)this.jComboNombre.getSelectedItem());
        if (c.getNombreCli().compareToIgnoreCase("")==0) {
           JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Nombre", "Atención!", JOptionPane.WARNING_MESSAGE);  
        }   

       }catch(Exception e2){
       JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Nombre", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
       }
   }
        
    
    if (jTextCp.getText().compareTo("") != 0){
        try{
            Integer.parseInt(this.jTextCp.getText());
        } catch (Exception e) {
            JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Codigo Postal valido ", "Atención!", JOptionPane.WARNING_MESSAGE);
            return false;
        }
    }
    
    if (jTextDoc.getText().compareTo("") != 0){
        try{
            Integer.parseInt(this.jTextDoc.getText());
        } catch (Exception e) {
            JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar un Numero de documento valido ", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
        }
    }
  return true;



}


/** Crea el Cliente del Pedido*/
private Cliente nuevoCliente(){
  //double doc;
  int cp;
  String fechaNac;
   
  /*if (jTextDoc.getText().isEmpty()) 
      doc = 0;
  else 
      doc = Double.parseDouble(jTextDoc.getText());*/

  if (jTextCp.getText().isEmpty())
      cp = 0;
  else
      cp = Integer.parseInt(jTextCp.getText().toString());
   
   if (jComboAnioNac.getSelectedItem().toString().compareTo("")==0 ||
    jComboMesNac.getSelectedItem().toString().compareTo("")==0 ||
    jComboDiaNac.getSelectedItem().toString().compareTo("")==0)
       fechaNac="";
   else
        fechaNac = jComboAnioNac.getSelectedItem().toString()+"-"+
                jComboMesNac.getSelectedItem().toString()+"-"+
                jComboDiaNac.getSelectedItem().toString()+" 00:00:00";
  String nom;
  try{
      nom = ((Cliente)jComboNombre.getSelectedItem()).getNombreCli();
  }catch (Exception e){
      nom = jComboNombre.getSelectedItem().toString();
  }
      
  
    mCliente = new Cliente( jComboTipoDoc.getSelectedItem().toString(),
           jTextDoc.getText() , (String) jComboApellido.getSelectedItem(),
           nom, fechaNac, jTextTelFijo.getText(), 
           jTextTelMovil.getText(), jTextMatricula.getText(), jTextMail.getText(),
           jTextDireccion.getText(), jComboEspecialidad.getSelectedItem().toString(),
           cp, jComboLocalidad.getSelectedItem().toString(),jComboProvincia.getSelectedItem().toString(), 
           jComboPais.getSelectedItem().toString(), jTextHobbie.getText());
  
    
    
    
   return mCliente;
  
}

/** Crea el Pedido*/
private Pedido nuevoPedido(){

    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    Calendar calendar = Calendar.getInstance();
    
    String estado, fechaEnvio = "", envio ="no";
    
    // Se fija si el pedido fue entregado o no
    if (jCheckEntregado.isSelected())
        estado = "entregado";
    else
        estado = "pendiente";
                
    //Si el pedido debe ser enviado, se establece la fecha de envio
    if (jCheckEnviar.isSelected()){
        fechaEnvio = jComboAnio.getSelectedItem().toString()+"-"+
                jComboMes.getSelectedItem().toString()+"-"+
                jComboDia.getSelectedItem().toString()+" 00:00:00";
        envio = "si";
    }
    
    //Crea el nuevo Pedido
    mPedido = new Pedido(format.format(calendar.getTime()), estado,
            Integer.parseInt(jComboDescuento.getSelectedItem().toString()),
            Integer.parseInt(jTextSenia.getText()), fechaEnvio, envio,jComboMoneda.getSelectedItem().toString());
    mPedido.setTotal(Float.valueOf(this.jLabelTotal.getText()));
    

   
    return mPedido;
} 
   
/** Crea el arrayList de DVDs para el pedido*/
private ArrayList<Integer> listaDvds(){
    mDvds = new ArrayList(); 
    
    for (int i=0 ; i<50 ; i++){
        if (virtualChecks1.get(i))
            mDvds.add(i+1);
        if (virtualChecks2.get(i))
            mDvds.add(i+1+50);
        if (virtualChecks3.get(i))
            mDvds.add(i+1+100);
        if (virtualChecks4.get(i))
            mDvds.add(i+1+150);
        
    }
    mDvds=ordenar(mDvds);       
    return mDvds;
    }







public Pedido getPedido(){
        return mPedido;
    }
    
    public void setPedido(Pedido val){
        this.mPedido = val;
    } 
    
    public Congreso getCongreso(){
        return mCongreso;
    }
    
    public void setCongreso(Congreso val){
        this.mCongreso = val;
    } 
    
    public float getSubtotal(){
        return subtotal;
    }
    
    public void setSubtotal(float val){
        this.subtotal = val;
    }
    
    public float getTotal(){
        return total;
    }
    
    public void setTotal(float val){
        this.total = val;
    }
    
     public float getDeuda(){
        return deuda;
    }
    
    public void setDeuda(float val){
        this.deuda = val;
    }
    
    
    public String getModo() {
        return modo;
    }
    
    public void setModo (String val) {
        this.modo = val;
    }
    
    public void setPpal(PpalForm p){
        this.ppal=p;
}
    
    
    
/** Acciones luego de seleccionar un congreso del combo*/
private void jComboCongresosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboCongresosActionPerformed
    //Se guarda el congreso seleccionado en el controller
    mCongreso = new Congreso();
    mCongreso = (Congreso)jComboCongresos.getSelectedItem();
    mRPedidoController.setCongreso(mCongreso);
    
    listaCheckActual=1;
    this.botonesChecks();
    

    // Se muestra el nombre del congreso seleccionado en la pantalla
    
    String diaI = mCongreso.getFechaInicio().substring(8, 10);  
    String mesI = mCongreso.getFechaInicio().substring(5, 7);
    String anioI = mCongreso.getFechaInicio().substring(0, 4);
    String fechaI = diaI+"/"+mesI+"/"+anioI;
    
    String diaF = mCongreso.getFechaFin().substring(8, 10);  
    String mesF = mCongreso.getFechaFin().substring(5, 7);
    String anioF = mCongreso.getFechaFin().substring(0, 4);
    String fechaF = diaF+"/"+mesF+"/"+anioF;
    
    jLabelTitulo.setText(mCongreso.getNombreCong() + " (Stock: " + mCongreso.getStockDvd() + ")");
    jLabelFechaInicio.setText(fechaI);
    jLabelFechaFin.setText(fechaF);
    jLabelCiudad.setText(mCongreso.getLocalidad());
    
    //Se habilita el panel de Clientes
    panelClienteEstado(true);
    //Se deshabilita el panel de Pedido
    panelPedidoEstado(false);
    
    // Se borran todos los checkBox 
    for (int i=0 ; i<50 ; i++)
            checks.get(i).setVisible(false);
    
    //Se cargan los checkBox de los DVDs disponibles para el Congreso seleccionado
     visualizarChecks();
     habilitarChecks(false);
    
}//GEN-LAST:event_jComboCongresosActionPerformed

private void visualizarChecks(){
   int auxCant=mRPedidoController.getCongreso().getCantDvd();
    switch(listaCheckActual){
        case 1: if(auxCant>50) auxCant=50;
            break;
        case 2: if(auxCant>100)auxCant=50;
                    else auxCant=auxCant-50;
            break;
        case 3: if(auxCant>150)auxCant=50;
                    else auxCant=auxCant-100;
            break;
        case 4: if(auxCant>200)auxCant=50;
                    else auxCant=auxCant-150;
            break;
    }
    for (int i=0 ; i<auxCant ; i++){
             checks.get(i).setVisible(true);
    }  
}
private void habilitarChecks(boolean b){
    int auxCant=mRPedidoController.getCongreso().getCantDvd();
    switch(listaCheckActual){
        case 1: if(auxCant>50) auxCant=50;
            break;
        case 2: if(auxCant>100)auxCant=50;
                    else auxCant=auxCant-50;
            break;
        case 3: if(auxCant>150)auxCant=50;
                    else auxCant=auxCant-100;
            break;
        case 4: if(auxCant>200)auxCant=50;
                    else auxCant=auxCant-150;
            break;
    }
    for (int i=0 ; i<auxCant ; i++){
             checks.get(i).setEnabled(b);
    }
}


/** Acciones luego de seleccionar o cargar un cliente */
private void jButtonAceptaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAceptaActionPerformed
    // Validar campos ingresados!!!!!!
    if (validarCampos()) {
    
    //Crea el nuevo Cliente. EXISTE? NO? LO VE EL FACADE? VER..
     mRPedidoController.setCliente(nuevoCliente());
     
    //Se habilita el panel de Pedido
      panelPedidoEstado(true);
      jComboMoneda.removeAllItems();
      jComboMoneda.addItem(mRPedidoController.getCongreso().getSimbM1());
      jComboMoneda.addItem(mRPedidoController.getCongreso().getSimbM2());
      jComboMoneda.addItem(mRPedidoController.getCongreso().getSimbM3());
      habilitarChecks(true);
             
      panelClienteEstado(false);
      Modificar_cliente.setEnabled(true);
      
      if (jCheckEnviar.isSelected() == false){
        jComboDia.setEnabled(false);
        jComboMes.setEnabled(false);
        jComboAnio.setEnabled(false);
      }
      
      
      
      
      jComboCongresos.setEnabled(false);
      this.jButtonHistorial.setEnabled(true);
      jLabelAviso.setVisible(false);
      
      }
        
}//GEN-LAST:event_jButtonAceptaActionPerformed

/** Acciones si se habilita o dehabilita el checkBox "todos" */
private void jCheckTodosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckTodosActionPerformed
    // Habilita o deshabilita checkbox si se presiona el checkBox "todos"
    int cantDvd = mRPedidoController.getCongreso().getCantDvd(); 
    if (jCheckTodos.isSelected()){
        cuentachecks = cantDvd;
        for (int i=0 ; i< 50; i++){
            if(i<cantDvd) virtualChecks1.set(i, true); 
            if(i+50<cantDvd) virtualChecks2.set(i, true); 
            if(i+100<cantDvd) virtualChecks3.set(i, true); 
            if(i+150<cantDvd) virtualChecks4.set(i, true);
            switch(listaCheckActual){
                case 1: if (i<cantDvd) checks.get(i).setSelected(true);
                    break;
                case 2: if (i+50<cantDvd) checks.get(i).setSelected(true);
                    break;
                case 3: if (i+100<cantDvd) checks.get(i).setSelected(true);
                    break;
                case 4: if (i+150<cantDvd) checks.get(i).setSelected(true);
                    break;    
            }
        }
        jComboDescuento.setEnabled(true);
        jTextSenia.setEnabled(true);
    }
    else{
        for (int i=0 ; i<50 ; i++){
           virtualChecks1.set(i, false);
           virtualChecks2.set(i, false);
           virtualChecks3.set(i, false);
           virtualChecks4.set(i, false);
           checks.get(i).setSelected(false); 
        }
            cuentachecks = 0;
            jComboDescuento.setEnabled(false);
            jTextSenia.setEnabled(false);
        }
    
    // Calcula Subtotal, total y deuda
    calculaSubtotal();
    calculaTotal();
    calculaDeuda();
    
//GEN-LAST:event_jCheckTodosActionPerformed
}                                           


private void seleccionaCheck(javax.swing.JCheckBox x){

   if (x.isSelected() == false)
        jCheckTodos.setSelected(false);
   if (x.isSelected()==true){
    cuentachecks = cuentachecks + 1;
    }else 
    {
    cuentachecks = cuentachecks - 1;
    }
    if (cuentachecks > 0){
    jComboDescuento.setEnabled(true);
    jTextSenia.setEnabled(true);
    }else 
    {
    jComboDescuento.setEnabled(false);
    jTextSenia.setEnabled(false);   
    }
   switch(listaCheckActual){
           case 1:virtualChecks1=this.copiarChecks(checks);
            break;
           case 2:virtualChecks2=this.copiarChecks(checks);
            break;
           case 3:virtualChecks3=this.copiarChecks(checks);
            break;
           case 4:virtualChecks4=this.copiarChecks(checks);
       }
   calculaSubtotal();
   calculaTotal();
   calculaDeuda();
   
}


/** Calcula el subtotal del pedido */
private void calculaSubtotal(){
   float subt = 0;
   float precioDvd=0;
   int moneda = jComboMoneda.getSelectedIndex();
   switch (moneda){
       case 0: precioDvd = mRPedidoController.getCongreso().getPrecioDvd();
       break;
       case 1: precioDvd = mRPedidoController.getCongreso().getPrecioDvdM2();
       break;
       case 2: precioDvd = mRPedidoController.getCongreso().getPrecioDvdM3();
       break;
   }
   int cantDvd = mRPedidoController.getCongreso().getCantDvd();
   
   // CASO 1 = Si esta marcado el checkBox "TODOS"
   if (jCheckTodos.isSelected())
    
       for (int i=0 ; i< cantDvd ; i++)
           subt = subt + precioDvd;
       
    // Caso 2 = No esta marcado el checkBox "TODOS"
   else{
       /* lo que hacia antes
        for (int i=0 ; i< cantDvd ; i++)
            if (checks.get(i).isSelected())
                subt = subt + precioDvd;*/
       for (int i=0; i<50;i++){
           if (virtualChecks1.get(i)==true)
               subt=subt+precioDvd;
           if (virtualChecks2.get(i)==true)
               subt=subt+precioDvd;
           if (virtualChecks3.get(i)==true)
               subt=subt+precioDvd;
           if (virtualChecks4.get(i)==true)
               subt=subt+precioDvd;                   
       }
   }
   //Setea el subtotal
    this.setSubtotal(subt);
    
   // Muestra el subtotal en la pantalla
    jLabelSubtotal.setText( Float.toString(subt));
}

/** Calcula el total del pedido */
private void calculaTotal(){
    float tot;
    float subt = Float.parseFloat(jLabelSubtotal.getText());
    float desc = Float.parseFloat(jComboDescuento.getSelectedItem().toString());
   
    tot =  subt - (subt * desc) / 100;
    
    //Setea el total
    this.setTotal(tot);
    
    // Muestra el total en la pantalla
    jLabelTotal.setText( Float.toString(tot));
} 

private boolean validarSenia( String cadena)
{
    try {
        Integer.parseInt(cadena);
        return true;
    } catch(Exception e2){
        return false;
    }
}
/** Calcula la deuda del pedido */
private void calculaDeuda(){
  float deu = 0;
  float senia=0;
   
    if (jTextSenia.getText().isEmpty())
        senia = 0;
    else
    try {
       senia = Integer.parseInt(jTextSenia.getText());   
        } catch(Exception e2){
            JOptionPane.showMessageDialog(new JFrame(), "El valor ingresado es incorrecto", "Atención", JOptionPane.WARNING_MESSAGE);
        jTextSenia.setText("0");
        }
    deu = this.getTotal() - senia;
      if (deu < 0){
        JOptionPane.showMessageDialog(new JFrame(), "La senia es mayor que la deuda!", "Atención", JOptionPane.WARNING_MESSAGE);
        jTextSenia.setText("0");
        calculaTotal();
        calculaDeuda();
    }
    else{
        //Setea la deuda 
        this.setDeuda(deu);
        // Muestra el total en la pantalla
        jLabelDeuda.setText(Float.toString(deu));
    }
}





/** Acciones si se presiona el checkBox "enviar" */
private void jCheckEnviarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckEnviarActionPerformed
    // Se habilitan o dehabilitan los combos para seleccionar fecha de envio
    if (jCheckEnviar.isSelected()){
         jCheckEntregado.setSelected(false);
         jComboDia.setEnabled(true);
         jComboMes.setEnabled(true);
         jComboAnio.setEnabled(true);
     }else{
         jComboDia.setEnabled(false);
         jComboMes.setEnabled(false);
         jComboAnio.setEnabled(false);
     }
}//GEN-LAST:event_jCheckEnviarActionPerformed

/** Si se ingresa un descuento recalcula el total y la duda */
private void jComboDescuentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboDescuentoActionPerformed
    calculaTotal();
    calculaDeuda();
}//GEN-LAST:event_jComboDescuentoActionPerformed


/** Acciones al aceptar el Pedido */

private void aceptarPedido(){
      
   if (validacionesPedido()){
        
    // Almacena el pedido
            // Crea el nuevo pedido y se guarda en el controller
            mRPedidoController.setPedido(nuevoPedido());

            //Crea la lista de DVDs del pedido y se guarda en el controller
            mRPedidoController.setDvds(listaDvds());
            
            int val = mRPedidoController.aceptarPedido();
            //Se acepta el Pedido
            if (val == 1 || val == 0){

            //Imprime
            Pedido auxPedido = mRPedidoController.getPedido();
            
            if (auxPedido.getCliente().getDireccion().compareTo("Null")==0)
                auxPedido.getCliente().setDireccion("");
            auxPedido.getCliente().setApellidoCli(auxPedido.getCliente().getApellidoCli().substring(0,auxPedido.getCliente().getApellidoCli().length()));
            auxPedido.getCliente().setNombreCli(auxPedido.getCliente().getNombreCli().substring(0,auxPedido.getCliente().getNombreCli().length()));

            
            if(jCheckEntregado.isSelected()){
                SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
                Calendar calendar = Calendar.getInstance();
                
                mRPedidoController.imprimirRecibo(String.valueOf(auxPedido.getNroPedido()),
                    auxPedido.getCliente().getApellidoCli()+", "+auxPedido.getCliente().getNombreCli(),
                    format.format(calendar.getTime()), String.valueOf(auxPedido.getTotal()),
                    auxPedido.getCongreso().getIniciales());
                
                                        
            }else{
                mRPedidoController.imprimirComprobante(String.valueOf(auxPedido.getNroPedido()), 
                    auxPedido.getCliente().getApellidoCli()+ ", "+ auxPedido.getCliente().getNombreCli(),
                    auxPedido.getCliente().getDireccion(), auxPedido.getDVDs(),
                    auxPedido.getFecha(), String.valueOf(auxPedido.getTotal()), 
                    String.valueOf(auxPedido.getSenia()),
                    String.valueOf(auxPedido.getTotal()-auxPedido.getSenia()), 
                    auxPedido.getCongreso().getIniciales());
            }    
            
            String mje;
            if (avisarEnQueCaja() == true)
                  mje = "(almacenado en caja del congreso)";
            else 
                  mje = "(almacenado en caja de Oficina ya que la fecha del congreso ya terminó)";
                        
         
            JOptionPane.showMessageDialog(new JFrame(), "El pedido se ha almacenado correctamente\n\n\n " + mje, "Atención!", JOptionPane.INFORMATION_MESSAGE);
            limpiarCliente();
            this.jComboNombre.setSelectedItem("");
            this.jComboApellido.setSelectedItem("");
            limpiarPedido();
            panelClienteEstado(true);
            panelPedidoEstado(false);
            jComboCongresos.setEnabled(true);

        }
            else  JOptionPane.showMessageDialog(new JFrame(), "Error al guardar los datos del cliente\nAsegurese que sean correctos ", "Atención!", JOptionPane.INFORMATION_MESSAGE);
            if (val == 0){
                JOptionPane.showMessageDialog(new JFrame(), "La cantidad de Dvds en Stock no es suficiente para este pedido.", "Atención!", JOptionPane.INFORMATION_MESSAGE);
            }
   }  
}    
    

private boolean validacionesPedido(){
    
    boolean esPedido = false;
    Object[] opciones ={"Si","No"};   
 
     // esPedido = true si se selcciona al menos 1 dvd
     for(int i=0 ; i<50 ; i++){
                if (virtualChecks1.get(i))
                    esPedido = true;
                if (virtualChecks2.get(i))
                    esPedido = true;
                if (virtualChecks3.get(i))
                    esPedido = true;
                if (virtualChecks4.get(i))
                    esPedido = true;
                if (esPedido) break;
            }

 //Si va con envio, hay que cargar la direccion
    if (cargaDireccion() == true){
        JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar todos los datos para poder realizar el envío a domicilio", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
    }
    
    // se fija que la fecha de envio sea posterior a la actual
    
    if (validaFechaEnvio() == true){
            JOptionPane.showMessageDialog(new JFrame(), "La fecha de envío debe ser posterior a la actual", "Atención!", JOptionPane.WARNING_MESSAGE);
            return false;
    }
    
    // Se fija que tenga dvds seleccionados
    if (esPedido == false){
            JOptionPane.showMessageDialog(new JFrame(), "Debe seleccionar al menos un DVD", "Atención!", JOptionPane.INFORMATION_MESSAGE);
            return false;
    }
     
    // Valida senna
    try{
        
        Integer.parseInt(jTextSenia.getText());
        if (jTextSenia.getText().compareTo("0") == 0){
          try{
             int selec = JOptionPane.showOptionDialog(new JFrame(), "No ha ingresado seña ¿Desea continuar?","Atención!",JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, opciones, null);
             if(selec != 0){
                 this.dispose(); 
                 return false;
             }
          } catch(Exception e2){}
         }
    
    }catch(Exception e){
        JOptionPane.showMessageDialog(new JFrame(), "Debe ingresar una seña válida", "Atención!", JOptionPane.WARNING_MESSAGE);
        return false;
 }
       
    return true;
}

private void limpiarCliente(){
         
            this.jTextDoc.setText("");
            this.jTextCp.setText("");
            this.jTextDireccion.setText("");
            this.jComboLocalidad.setSelectedItem("");
            this.jComboProvincia.setSelectedItem("");
            this.jComboPais.setSelectedItem("");
            this.jComboTipoDoc.setSelectedItem("");
            this.jComboEspecialidad.setSelectedItem("");
            this.jTextMail.setText("");
            this.jTextMatricula.setText("");
            this.jTextTelFijo.setText("");
            this.jTextTelMovil.setText(""); 
            this.jComboDiaNac.setSelectedItem("");
            this.jComboMesNac.setSelectedItem("");
            this.jComboAnioNac.setSelectedItem("");
            this.jTextHobbie.setText("");
}


private void limpiarPedido(){
    jTextSenia.setText("0");
  for(int i=0 ; i<checks.size() ; i++){
      checks.get(i).setSelected(false);
      checks.get(i).setEnabled(false);
  }
  this.reinicializarChecks();
  jCheckTodos.setSelected(false);
  jCheckEnviar.setSelected(false);
  jCheckEntregado.setSelected(false);
  jComboDia.setEnabled(false);
  jComboMes.setEnabled(false);
  jComboAnio.setEnabled(false);
  
  jComboDescuento.setSelectedIndex(0);
  jComboDescuento.setEnabled(false);
  jTextSenia.setEnabled(false);   
  
  calculaSubtotal();
  calculaTotal();
  calculaDeuda();

}

/** Acciones si se presiona el checkBox "entregado" */
private void jCheckEntregadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckEntregadoActionPerformed
    if (jCheckEntregado.isSelected()){
        jCheckEnviar.setSelected(false);
      //  jCheckEnviar.setEnabled(false);
        jComboDia.setEnabled(false);
        jComboMes.setEnabled(false);
        jComboAnio.setEnabled(false);
    }else
        jCheckEnviar.setEnabled(true);
}//GEN-LAST:event_jCheckEntregadoActionPerformed

/** deshabilita la edicion de los detalles de cliente despues de ver el historial*/
/*public void deshabilitarPanelPosHistorial(){
    bjnbjPanelCliente.setEnabled(false);
    jButtonHistorial.setEnabled(true);
    
}

*/

public class CheckBoxListener implements ItemListener  {
    public void itemStateChanged(ItemEvent e) {

	Object source = e.getItemSelectable();
        seleccionaCheck((javax.swing.JCheckBox)source);

        

    }
}

/** Si se ingresa una senia recalcula la deuda */
private void jTextSeniaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextSeniaActionPerformed
    calculaTotal();   
    calculaDeuda();
}//GEN-LAST:event_jTextSeniaActionPerformed

private void jCheck37ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheck37ActionPerformed
  //  seleccionaCheck(jCheck37);
}//GEN-LAST:event_jCheck37ActionPerformed

private void jComboApellidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboApellidoActionPerformed
    //cargaComboNombres();
    buscaComboApellido();
}//GEN-LAST:event_jComboApellidoActionPerformed

private void jTextCpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextCpActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextCpActionPerformed

private void jComboNombreItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboNombreItemStateChanged
if (jComboNombre.getSelectedItem()!=null){
        try{
            Cliente auxCli= (Cliente)jComboNombre.getSelectedItem();
            this.jTextDoc.setText(auxCli.getNroDocumento());
            this.jTextCp.setText(String.valueOf(auxCli.getCP()));
            this.jTextDireccion.setText(auxCli.getDireccion());
            this.jComboLocalidad.setSelectedItem(auxCli.getLocalidad());
            this.jComboProvincia.setSelectedItem(auxCli.getProvincia());
            this.jComboPais.setSelectedItem(auxCli.getPais());
            this.jComboTipoDoc.setSelectedItem(auxCli.getTipoDocumento());
            this.jComboEspecialidad.setSelectedItem(auxCli.getEspecialidad());
            this.jTextMail.setText(auxCli.getMail());
            this.jTextMatricula.setText(auxCli.getMatricula());
            this.jTextTelFijo.setText(auxCli.getTelFijo());
            this.jTextTelMovil.setText(auxCli.getTelMovil()); 
            this.jTextHobbie.setText(auxCli.getHobbie());
            try {
            if (auxCli.getFechaNac().length()>0){
            this.jComboDiaNac.setSelectedItem(auxCli.getFechaNac().substring(8, 10));
            this.jComboMesNac.setSelectedItem(auxCli.getFechaNac().substring(5, 7));
            this.jComboAnioNac.setSelectedItem(auxCli.getFechaNac().substring(0, 4));
            }  }catch(Exception e2){
            this.jComboDiaNac.setSelectedItem("");
            this.jComboMesNac.setSelectedItem("");
            this.jComboAnioNac.setSelectedItem("");    
            }
            
        } catch (Exception e) {
            this.jTextDoc.setText("");
            this.jTextCp.setText("");
            this.jTextDireccion.setText("");
            this.jComboLocalidad.setSelectedItem("");
            this.jComboProvincia.setSelectedItem("");
            this.jComboPais.setSelectedItem("");
            this.jComboTipoDoc.setSelectedItem("");
            this.jComboEspecialidad.setSelectedItem("");
            this.jTextMail.setText("");
            this.jTextMatricula.setText("");
            this.jTextTelFijo.setText("");
            this.jTextTelMovil.setText(""); 
            this.jComboDiaNac.setSelectedItem("");
            this.jComboMesNac.setSelectedItem("");
            this.jComboAnioNac.setSelectedItem("");
            this.jTextHobbie.setText("");
            
        }
    }
}//GEN-LAST:event_jComboNombreItemStateChanged

private void jTextSeniaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextSeniaKeyTyped
    calculaTotal();
    calculaDeuda();
}//GEN-LAST:event_jTextSeniaKeyTyped

private void jButtonHistorialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonHistorialActionPerformed
    if (validarCampos()){
    DetallesForm gForm = new DetallesForm(this,true,nuevoCliente(),null,this);
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenSize = tk.getScreenSize();
    int screenHeight = screenSize.height;
    int screenWidth = screenSize.width;
    gForm.setLocation(screenWidth / 4, screenHeight / 4);
    gForm.setVisible(true);
    }
        
    
}//GEN-LAST:event_jButtonHistorialActionPerformed

private void jButtonLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLimpiarActionPerformed
       limpiarCliente();
}//GEN-LAST:event_jButtonLimpiarActionPerformed

private void jTextSeniaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextSeniaKeyReleased
    calculaTotal();
    calculaDeuda();
}//GEN-LAST:event_jTextSeniaKeyReleased

private void jButtonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarActionPerformed
     ppal.cargarFormulario();
     this.dispose();
}//GEN-LAST:event_jButtonCancelarActionPerformed

private void jButtonAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAceptarActionPerformed
    
        aceptarPedido();    
        mRPedidoController.cargarClientes();  
        mRPedidoController.cargarApellidos();
        mRPedidoController.cargaCombos(jComboApellido,mRPedidoController.getApellidos());
}//GEN-LAST:event_jButtonAceptarActionPerformed

private void jButtonMasCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMasCheckActionPerformed
    listaCheckActual++;
    switch(listaCheckActual){
        case 1: restaurarChecks(checks,virtualChecks1); 
            break;
        case 2: restaurarChecks(checks,virtualChecks2); 
            break;
        case 3: restaurarChecks(checks,virtualChecks3); 
            break;
        case 4: restaurarChecks(checks,virtualChecks4); 
            break;
    }
     // Se borran todos los checkBox 
    for (int i=0 ; i<50 ; i++)
            checks.get(i).setVisible(false);
    
    visualizarChecks();
    habilitarChecks(true);
    botonesChecks();
    
    cambiarLabels();
    
            
    
    
}//GEN-LAST:event_jButtonMasCheckActionPerformed

private void cambiarLabels(){
    for(int i=0;i<50;i++)
        switch(listaCheckActual){
            case 1: checks.get(i).setText(String.valueOf(i+1));
                    if (i<9)checks.get(i).setText("0"+checks.get(i).getText()); 
                break;
            case 2: checks.get(i).setText(String.valueOf(i+51));
                    checks.get(i).setFont(checks.get(i).getFont().deriveFont(10.0f));
                break;
            case 3: checks.get(i).setText(String.valueOf(i+101));
                    checks.get(i).setFont(checks.get(i).getFont().deriveFont(8.0f));
                break;
            case 4: checks.get(i).setText(String.valueOf(i+151));
                break;    
        }
}

private void jButtonMenosCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMenosCheckActionPerformed
listaCheckActual--;
    switch(listaCheckActual){
        case 1: restaurarChecks(checks,virtualChecks1); 
            break;
        case 2: restaurarChecks(checks,virtualChecks2); 
            break;
        case 3: restaurarChecks(checks,virtualChecks3); 
            break;
        case 4: restaurarChecks(checks,virtualChecks4); 
            break;
    }
     // Se borran todos los checkBox 
    for (int i=0 ; i<50 ; i++)
            checks.get(i).setVisible(false);
    visualizarChecks();
    habilitarChecks(true);
    botonesChecks();
    
    cambiarLabels();
}//GEN-LAST:event_jButtonMenosCheckActionPerformed

private void Modificar_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Modificar_clienteActionPerformed
//Crea el nuevo Cliente. EXISTE? NO? LO VE EL FACADE? VER..
    // mRPedidoController.setCliente(nuevoCliente());
     
    //Se deshabilita el panel de Pedido
      panelPedidoEstado(false);
      
      
      habilitarChecks(false);
             
      panelClienteEstado(true);
      
      
        jCheckEnviar.setEnabled(false);
        jComboDia.setEnabled(false);
        jComboMes.setEnabled(false);
        jComboAnio.setEnabled(false);
      
      
      
      
      Modificar_cliente.setEnabled(false);
      jComboCongresos.setEnabled(false);
      this.jButtonHistorial.setEnabled(false);
      jLabelAviso.setVisible(false);
      
      
}//GEN-LAST:event_Modificar_clienteActionPerformed

private void jComboMonedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboMonedaActionPerformed
    calculaSubtotal();
    calculaTotal();
    calculaDeuda();
}//GEN-LAST:event_jComboMonedaActionPerformed

private boolean avisarEnQueCaja(){
    boolean error = false;
   Calendar calendar = Calendar.getInstance();
   Calendar fechaFin = Calendar.getInstance();
   Calendar fechaAct = Calendar.getInstance();
   Calendar fechaIni = Calendar.getInstance();
   
   int anioI = Integer.parseInt(mCongreso.getFechaInicio().substring(0,4));
   int mesI = Integer.parseInt(mCongreso.getFechaInicio().substring(5,7));
   int diaI = Integer.parseInt(mCongreso.getFechaInicio().substring(8,10));
   
   
   int anioF = Integer.parseInt(mCongreso.getFechaFin().substring(0,4));
   int mesF = Integer.parseInt(mCongreso.getFechaFin().substring(5,7));
   int diaF = Integer.parseInt(mCongreso.getFechaFin().substring(8,10));
   
   int anioA = calendar.get(Calendar.YEAR);
   int mesA = calendar.get(Calendar.MONTH) + 1;
   int diaA = calendar.get(Calendar.DAY_OF_MONTH);
   
   fechaIni.set(anioI, mesI, diaI);
   fechaFin.set(anioF, mesF, diaF);
   fechaAct.set(anioA, mesA, diaA);
   
   /*   true = caja del congreso
         false = caja de Oficina   */
    if (fechaIni.compareTo(fechaAct) <= 0  &&  fechaFin.compareTo(fechaAct) >= 0 )
           error = true;
    

    return error;
}


private boolean validaFechaEnvio(){
    boolean error = false;
    
    if (jCheckEnviar.isSelected()){
      
        Calendar calendar = Calendar.getInstance();
        Calendar fechaEnv = Calendar.getInstance();
        Calendar fechaAct = Calendar.getInstance();
        
        int anioE = Integer.parseInt(jComboAnio.getSelectedItem().toString());
        int mesE = Integer.parseInt(jComboMes.getSelectedItem().toString());
        int diaE = Integer.parseInt(jComboDia.getSelectedItem().toString());
        
        
        int anioA = calendar.get(Calendar.YEAR);
        int mesA = calendar.get(Calendar.MONTH) + 1;
        int diaA = calendar.get(Calendar.DAY_OF_MONTH);
      
       
        fechaEnv.set(anioE, mesE, diaE);
        fechaAct.set(anioA, mesA, diaA);
        
        if (fechaEnv.compareTo(fechaAct) < 0 )
                error = true;
    }

    return error;
}


private boolean cargaDireccion(){
    boolean carga = false;
    
    if (jCheckEnviar.isSelected()){
            if (jTextDireccion.getText().compareTo("") == 0 ||
                jComboLocalidad.getSelectedItem().toString().compareTo("") == 0 ||
                jComboProvincia.getSelectedItem().toString().compareTo("") == 0 ||
                jTextCp.getText().compareTo("") == 0 ||
                jComboPais.getSelectedItem().toString().compareTo("") == 0){
                        panelClienteEstado(true);
                        jButtonAceptar.setEnabled(false);
                        jLabelAviso.setVisible(true);
                        carga = true;
            }
    }
    return carga;
}

private ArrayList<Integer> ordenar(ArrayList<Integer> str){
    ArrayList<Integer> aux= new ArrayList<Integer>();
    for (int i=0;i<str.size();i++){
        int j=0;
        while(j<aux.size()){
            if (aux.get(j) > str.get(i))
                break;
            j++;
        }
        aux.add(j, str.get(i));            
    }
    return aux;
}
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Modificar_cliente;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonAcepta;
    private javax.swing.JButton jButtonAceptar;
    private javax.swing.JButton jButtonCancelar;
    private javax.swing.JButton jButtonHistorial;
    private javax.swing.JButton jButtonLimpiar;
    private javax.swing.JButton jButtonMasCheck;
    private javax.swing.JButton jButtonMenosCheck;
    private javax.swing.JCheckBox jCheck1;
    private javax.swing.JCheckBox jCheck10;
    private javax.swing.JCheckBox jCheck11;
    private javax.swing.JCheckBox jCheck12;
    private javax.swing.JCheckBox jCheck13;
    private javax.swing.JCheckBox jCheck14;
    private javax.swing.JCheckBox jCheck15;
    private javax.swing.JCheckBox jCheck16;
    private javax.swing.JCheckBox jCheck17;
    private javax.swing.JCheckBox jCheck18;
    private javax.swing.JCheckBox jCheck19;
    private javax.swing.JCheckBox jCheck2;
    private javax.swing.JCheckBox jCheck20;
    private javax.swing.JCheckBox jCheck21;
    private javax.swing.JCheckBox jCheck22;
    private javax.swing.JCheckBox jCheck23;
    private javax.swing.JCheckBox jCheck24;
    private javax.swing.JCheckBox jCheck25;
    private javax.swing.JCheckBox jCheck26;
    private javax.swing.JCheckBox jCheck27;
    private javax.swing.JCheckBox jCheck28;
    private javax.swing.JCheckBox jCheck29;
    private javax.swing.JCheckBox jCheck3;
    private javax.swing.JCheckBox jCheck30;
    private javax.swing.JCheckBox jCheck31;
    private javax.swing.JCheckBox jCheck32;
    private javax.swing.JCheckBox jCheck33;
    private javax.swing.JCheckBox jCheck34;
    private javax.swing.JCheckBox jCheck35;
    private javax.swing.JCheckBox jCheck36;
    private javax.swing.JCheckBox jCheck37;
    private javax.swing.JCheckBox jCheck38;
    private javax.swing.JCheckBox jCheck39;
    private javax.swing.JCheckBox jCheck4;
    private javax.swing.JCheckBox jCheck40;
    private javax.swing.JCheckBox jCheck41;
    private javax.swing.JCheckBox jCheck42;
    private javax.swing.JCheckBox jCheck43;
    private javax.swing.JCheckBox jCheck44;
    private javax.swing.JCheckBox jCheck45;
    private javax.swing.JCheckBox jCheck46;
    private javax.swing.JCheckBox jCheck47;
    private javax.swing.JCheckBox jCheck48;
    private javax.swing.JCheckBox jCheck49;
    private javax.swing.JCheckBox jCheck5;
    private javax.swing.JCheckBox jCheck50;
    private javax.swing.JCheckBox jCheck6;
    private javax.swing.JCheckBox jCheck7;
    private javax.swing.JCheckBox jCheck8;
    private javax.swing.JCheckBox jCheck9;
    private javax.swing.JCheckBox jCheckBox6;
    private javax.swing.JCheckBox jCheckEntregado;
    private javax.swing.JCheckBox jCheckEnviar;
    private javax.swing.JCheckBox jCheckTodos;
    private javax.swing.JComboBox jComboAnio;
    private javax.swing.JComboBox jComboAnioNac;
    private javax.swing.JComboBox jComboApellido;
    private javax.swing.JComboBox jComboCongresos;
    private javax.swing.JComboBox jComboDescuento;
    private javax.swing.JComboBox jComboDia;
    private javax.swing.JComboBox jComboDiaNac;
    private javax.swing.JComboBox jComboEspecialidad;
    private javax.swing.JComboBox jComboLocalidad;
    private javax.swing.JComboBox jComboMes;
    private javax.swing.JComboBox jComboMesNac;
    private javax.swing.JComboBox jComboMoneda;
    private javax.swing.JComboBox jComboNombre;
    private javax.swing.JComboBox jComboPais;
    private javax.swing.JComboBox jComboProvincia;
    private javax.swing.JComboBox jComboTipoDoc;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelAviso;
    private javax.swing.JLabel jLabelCiudad;
    private javax.swing.JLabel jLabelDeuda;
    private javax.swing.JLabel jLabelFechaFin;
    private javax.swing.JLabel jLabelFechaInicio;
    private javax.swing.JLabel jLabelSubtotal;
    private javax.swing.JLabel jLabelTitulo;
    private javax.swing.JLabel jLabelTotal;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanelCliente;
    private javax.swing.JPanel jPanelPedido;
    private javax.swing.JPanel jPanelTitulo;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField jTextCp;
    private javax.swing.JTextField jTextDireccion;
    private javax.swing.JTextField jTextDoc;
    private javax.swing.JTextField jTextHobbie;
    private javax.swing.JTextField jTextMail;
    private javax.swing.JTextField jTextMatricula;
    private javax.swing.JTextField jTextSenia;
    private javax.swing.JTextField jTextTelFijo;
    private javax.swing.JTextField jTextTelMovil;
    // End of variables declaration//GEN-END:variables
  
}
